﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReadyApps.Data.Wiki
{
    /// <summary>
    /// Contains information on the settings for a page within the wiki system.
    /// </summary>
    public class PageDetails
    {
        #region Variables and Constants

        private readonly static PageDetails empty;

        #endregion

        #region Properties

        /// <summary>
        /// Gets a value indicating whether the page is part of a security-enabled
        /// site.
        /// </summary>
        public bool Secured { get; private set; }

        /// <summary>
        /// Gets or sets a value indicating whether the page is currently maintaining
        /// a revision history.
        /// </summary>
        public bool Versioned { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the publishing workflow has been
        /// enabled for the page.
        /// </summary>
        public bool Publishable { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether there is a pending revision of
        /// the page.
        /// </summary>
        public bool PendingRevision { get; set; }

        /// <summary>
        /// Gets or sets the username of the user that made the last pending change
        /// to the page.
        /// </summary>
        public string PendingRevisionAuthor { get; set; }

        /// <summary>
        /// Gets the common empty details value.
        /// </summary>
        public static PageDetails Empty
        {
            get { return empty; }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Creates the static empty object value.
        /// </summary>
        static PageDetails()
        {
            empty = new PageDetails(false, false, false, false, string.Empty);
        }

        /// <summary>
        /// Creates a new <see cref="PageDetails"/> object with the given setting values.
        /// </summary>
        /// <param name="secured">A value indicating whether or not the page's site is
        /// security-enabled.</param>
        /// <param name="versioned">A value indicating whether or not the page is being
        /// versioned.</param>
        /// <param name="publishable">A value indicating whether or not the publishing
        /// workflow has been enabled for the page.</param>
        /// <param name="pendingRevision">A value indicating whether or not there is a
        /// currently pending revision of the page.</param>
        /// <param name="pendingRevisionAuthor">The username of the user that made the
        /// changes to the currently pending revision of the page.</param>
        public PageDetails(bool secured, bool versioned, bool publishable, bool pendingRevision, string pendingRevisionAuthor)
        {
            Secured = secured;
            Versioned = versioned;
            Publishable = publishable;
            PendingRevision = pendingRevision;
            PendingRevisionAuthor = pendingRevisionAuthor;
        }

        #endregion
    }
}
